
let vm = new Vue({
    el: '#index',
    data: {
        tableData: [{
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄',
        }, {
            date: '2016-05-04',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1517 弄',
        }, {
            date: '2016-05-01',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1519 弄',
        }],
        headerList: [],      //a的内容
        materialList: [],    //原料加工
        shaftList: [],       //轴织加工
        weavList: [],        //布织加工
        fabricTotalNum: '',   //胚布总耗用
        fabricTotalPrice: '',   //胚布单位成本
        hzMachinList: []       //后整加工
    },
    methods: {

        getData() {
            leiku.post('http://dongtai.fsslpc.com/api/2020090907992422', {zbwjid1: leiku.GetUrlParam("zbwjid1"),jrwjid: leiku.GetUrlParam("jrwjid"),zbwjid2: leiku.GetUrlParam("zbwjid2"),zbwjid3: leiku.GetUrlParam("zbwjid3"),scjhid: leiku.GetUrlParam("scjhid")}, res => {
                let data = res.data;
                console.log(res.data)
                if (data) {
                    this.headerList = data.a;
                    this.materialList = data.b;
                    this.shaftList = data.c;
                    this.fabricTotalNum = data.zbsum[0].pbzhy
                    this.fabricTotalPrice = data.zbsum[0].pbdanjia
                    this.hzMachinList = data.hz

                    let arr = [];
                    data.zb.forEach((v, i) => {
                        let obj = {};
                        obj.zb = v
                        obj.tb1 = data.zh.filter((litem) => {
                            return litem.row == i + 1;
                        });
                        obj.tb2 = data.l.filter((litem) => {
                            return litem.row == i + 1;
                        });
                        arr.push(obj);
                    });
                    this.weavList = arr
                    // console.log(this.weavList)

                }
                console.log(this.weavList);
                // console.log(data.l)
            })
        },


        prints() {
            // console.log(this.$print)
            //    this.$print(this.$refs.printPage)

            $(this.$refs.printPage).print({
                stylesheet: "../css/heightSty.css",
                globalStyles: true,
                mediaPrint: false,
                iframe: true,
            });
        },


        // 表头样式
        thStyle() {
            return 'text-align: center; font-size: 13px; padding: 1px;border-collapse: collapse;'
        },
        // 表格内容居中
        cellstyle() {
            return 'text-align: center; font-size: 12px; padding: 2px;border-collapse: collapse;'
        }
        // 索引
        // indexMethod(index) {
        //     return index+1
        // },
    },
    mounted() {
        this.getData();
    }
})